From 538b987bc55fe634e7343f722cac0d8763a15eae Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 20 May 2014 21:43:00 -0400 Subject: [PATCH] inspector: Add a way to highlight widgets In contrast to the flashing, where we blink the widget a few times, this is explicitly turned on and off. It will be used for indicating widgets that are part of a size group, in the next commit. --- gtk/inspector/inspect-button.c | 16 +++++++++++++++- gtk/inspector/window.h | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c index fe438ffc5c..c4553967b2 100644 --- a/gtk/inspector/inspect-button.c +++ b/gtk/inspector/inspect-button.c @@ -299,7 +299,7 @@ draw_flash (GtkWidget *widget, { GtkAllocation alloc; - if (iw->flash_count % 2 == 0) + if (iw && iw->flash_count % 2 == 0) return FALSE; if (GTK_IS_WINDOW (widget)) @@ -359,4 +359,18 @@ gtk_inspector_flash_widget (GtkInspectorWindow *iw, iw->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, iw); } +void +gtk_inspector_start_highlight (GtkWidget *widget) +{ + g_signal_connect_after (widget, "draw", G_CALLBACK (draw_flash), NULL); + gtk_widget_queue_draw (widget); +} + +void +gtk_inspector_stop_highlight (GtkWidget *widget) +{ + g_signal_handlers_disconnect_by_func (widget, draw_flash, NULL); + gtk_widget_queue_draw (widget); +} + /* vim: set et sw=2 ts=2: */ diff --git a/gtk/inspector/window.h b/gtk/inspector/window.h index 2621f26a1a..1349f9590e 100644 --- a/gtk/inspector/window.h +++ b/gtk/inspector/window.h @@ -50,6 +50,7 @@ typedef struct GtkWidget *classes_list; GtkWidget *widget_css_editor; GtkWidget *object_hierarchy; + GtkWidget *size_groups; GtkWidget *data_list; GtkWidget *actions; @@ -75,7 +76,10 @@ GType gtk_inspector_window_get_type (void); GtkWidget *gtk_inspector_window_new (void); void gtk_inspector_flash_widget (GtkInspectorWindow *iw, - GtkWidget *widget); + GtkWidget *widget); +void gtk_inspector_start_highlight (GtkWidget *widget); +void gtk_inspector_stop_highlight (GtkWidget *widget); + G_END_DECLS -- 2.30.2